

#include <p32xxxx.h>
#include <plib.h>
//#include <delays.h>

#pragma config FNOSC=PRIPLL
#pragma config POSCMOD=XY
#pragma config FPBDIV=DIV_8
#pragma config FWDTEN=OFF
#pragma config FPLLIDIV=DIV_2
#pragma config FPLLMUL=MUL_20
#pragma config FPLLODIV=DIV_1

#pragma interupt CAMBIO ipll vector 0

int count;

void CAMBIO(void) {
    count++;
    mT2ClearIntFlag();
}
int main(int argc, char** argv)
{
    SYSTEMConfigPerformance(80000000);
    mOSCSetPBDIV(OSC_PB_DIV_8);
    PR2=15;
    T2CON=0x8030;
    mT2SetIntPriority(1);
    INTEnableSystemSingleVectoredInt();
    mT2IntEnable(1);
    while(1)
    {
        TRISA=7;
        TRISB=256;
        if(PORTAbits.RA0==1)
        {
            PORTB=5;
        }
        if(PORTAbits.RA1==1)
        {
            PORTB=3;
        }
        if(PORTAbits.RA2==1)
        {
            PORTB=6;
        }
    }
    return(EXIT_SUCCESS);

}